<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>
<body>
    <div id="app">
        <h1 :title="title">标题</h1>
        <p>{{message.split('').reverse().join('')}}</p>
        <p>{{reverseMessage}}</p>
        <p>{{reverseMessage1()}}</p>

    
        <input type="button" value="ok" @click="handleClick">
    </div>
    <script src="https://cdn.jsdelivr.net/npm/vue@2.7.10/dist/vue.js"></script>
    <script>
        let app = new Vue({
            el:"#app",
            data:{
                title:"标题",
                message:"hello vue"
            },
            computed:{
                reverseMessage:{
                    get(){
                        console.log("reverseMessage")
                        return this.message.split('').reverse().join('');
                    },
                    set(value){
                        console.log("set");
                        this.message = value;
                    }
                }
            },
            methods:{
                handleClick(){
                    console.log("click");
                    // this.message = "你好，vue";
                    // this.title = "this is title";
                    this.reverseMessage = "123";
                },
                reverseMessage1(){
                    console.log("reverseMessage1")
                    return this.message.split('').reverse().join('');
                }
            }
        });
    </script>
</body>
</html>